from typing import Optional, List

from pydantic import Field

from models.common import MongoModel, RWModel, OID
from enum import Enum


class DivisionRegion(MongoModel):
    area:       Optional[str]
    country:    Optional[str]
    province:   Optional[str]
    city:       Optional[str]
    district:   Optional[str]


class AdministrativeDivision(MongoModel):
    region: Optional[DivisionRegion] = Field(title="区划信息")
    region_code: Optional[str] = Field(title="区划代码")


class RegionType(str, Enum):
    country = "country"
    province = "province"
    city = "city"
    district = "district"


class RegionHierarchy(RWModel):
    id: Optional[OID]
    code: Optional[str]
    name: Optional[str]
    alias: Optional[List[str]]
    type: Optional[RegionType]
    area: Optional[str] # 地区，比如：华东等
    path: Optional[str]
